﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace LabMS.Web.Equipment.LowValue
{
    public partial class lowconform : Base.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            strPagePrivilege.Add("DZPWXYS");//必须写在ispostback外
            strPageUserType.Add("mana");

            if (!Page.IsPostBack)
            {
                databind(" Type='lowvalue' and GoodsMaintain.Status='修复' ");
            }
        }

        public void databind(string strWhere)
        {
            ExtendBLL.GoodsMaintain bgm = new ExtendBLL.GoodsMaintain();
            List<ExtendModule.GoodsMaintain> gmlist = bgm.GetExtendModuleList(strWhere);
            gvconformlist.DataSource = gmlist;
            gvconformlist.DataBind();
        }




        protected void GridViewInstrument_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gvconformlist.PageIndex = e.NewPageIndex;
            if (tbKeyWords.Text.Trim().Equals(""))
            {
                databind(" Type='lowvalue' and GoodsMaintain.Status='修复'");
            }
            else
            {
                string strWhere = " Type='lowvalue' and GoodsMaintain.Status='修复' and GoodsMaintain." + ddlCClass.SelectedValue + " like '%" + tbKeyWords.Text.Trim() + "%'";
                databind(strWhere);
            }
        }

        protected void GridViewInstrument_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';this.style.color='#003399'");
                //e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#6699FF';this.style.color='#8C4510'");
                e.Row.Attributes["style"] = "Cursor:pointer";
                int itemp = e.Row.Cells.Count;
                for (int i = 1; i < itemp; i++)
                {
                    e.Row.Cells[i].Attributes.Add("OnDblClick", "window.location.href='lowconform.aspx?ID=" + gvconformlist.DataKeys[gvconformlist.DataKeys.Count - 1].Value.ToString() + "'");
                }
            }
        }

        protected void lbRefresh_Click(object sender, EventArgs e)
        {
            databind(" Type='lowvalue' and GoodsMaintain.Status='修复' ");
        }

        protected void lbSearch_Click(object sender, EventArgs e)
        {
            string strWhere = " Type='lowvalue' and GoodsMaintain.Status='修复' and GoodsMaintain." + ddlCClass.SelectedValue + " like '%" + tbKeyWords.Text.Trim() + "%'";
            databind(strWhere);
        }
    }
}
